package com.itheima.weirpc.registry;

import com.itheima.weirpc.spi.SpiLoader;

/**
 * ClassName: RegistryFactory
 * Package: com.itheima.weirpc.registry
 * Description:
 *      注册中心工厂（用于获取注册中心对象）
 * @Author 看到风
 * @Create 2024/11/24 16:37
 * @Version 1.0
 */
public class RegistryFactory {
    //SPI 动态加载
    static {
        SpiLoader.load(Registry.class);
    }

    /**
     * 默认注册中心
     */
    private static final Registry DEFAULT_REGISTRY = new EtcdRegistry();

    /**
     * 获取实例
     *
     */
    public static Registry getInstance(String key){
        return SpiLoader.getInstance(Registry.class,key);
    }
}
